package com.meepo.sdk.component.view.activity

import android.os.Bundle
import androidx.annotation.CallSuper
import com.meepo.sdk.component.view.IView
import com.meepo.sdk.component.view.Presenter
import com.trello.rxlifecycle2.LifecycleTransformer
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity

abstract class BaseActivity : RxAppCompatActivity(), IView {

    protected val presenter by lazy { Presenter(this) }

    @CallSuper
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val mRootView = layoutInflater.inflate(setUpContentLayout(), null)
        setContentView(mRootView)
        initView(mRootView, savedInstanceState)
        initData()
    }

    override fun <T> bindToLife(): LifecycleTransformer<T> = this.bindToLifecycle()
}